myApp.factory('examManagementService', ['$http', '$q', '$rootScope', function ($http, $q, $rootScope) {
    var examManagementService = {};
    var apiUrl = $rootScope.url + '/api/web/exam';
    var that = this; //
    var defered = $q.defer();
    var url = $rootScope.urlZ;
    var postCfg = {
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        transformRequest: function (data) {
            return $.param(data);
        }
    };
    /*
     *获取考试列表
     * */
    examManagementService.getList = function () {
        return $http.get(apiUrl + '/list');
    };

    /*
     *获取试卷分组列表
     * */
    examManagementService.paperGroup = function () {
        return $http.get(apiUrl + '/paper-group');
    };


    examManagementService.examPaperRelation = function (examId,paperId) {
        var data={
            'examId':examId,
            'paperId':paperId
        }
        return $http.post(apiUrl+'/exam-paper-relation',data,postCfg);
    }

    return examManagementService;
}]);
